<?php
	chong_pha_hoai();
?>
<?php
	echo "<p>TRANG GIỎ HÀNG</p>";
?>
<style>
	span.jjj_gio_hang
	{
		margin-left:5px
	}
</style>
<center>
<form action="" method="post" style="margin:0">
	<table width="640px" border="1">
	  <tr style="background-color:#666666;color:#FFFFFF;font-weight:bold;">
		<td align="center" width="50px">STT</td>
		<td width="250px"><span class="jjj_gio_hang">Tên sản phẩm</span></td>
		<td width="100px"><span class="jjj_gio_hang">Số lượng</span></td>
		<td width="120px"><span class="jjj_gio_hang">Đơn giá</span></td>
		<td width="120px"><span class="jjj_gio_hang">Tổng số</span></td>
	  </tr>
	  <?php
	  	$tong_lon=0;
	  	$so=count($_SESSION[$ten_danh_dau.'id_giohang']);
	  	for($r=0;$r<$so;$r++)
		{
			$j=0;
			$q=$r+1;
			$solg=$_SESSION[$ten_danh_dau.'solg_abc'][$r];
			$id_sp=$_SESSION[$ten_danh_dau.'id_giohang'][$r];
			$tv="select * from sanpham where id_sanpham=$id_sp";
			$tv_1=mysql_query($tv);
			$tv_2=mysql_fetch_array($tv_1);
			$tong=$solg*$tv_2['dongia_sanpham'];
			$tong_lon=$tong_lon+$tong;
			$ten_input__solg="solg_kkk___$r";
			if($solg!=0)
			{
				$j=$j+1;
				?>
					<tr>
						<td align="center"><?php echo $j; ?></td>
						<td><span class="jjj_gio_hang"><?php echo $tv_2['ten_sanpham']; ?></span></td>
						<td><span class="jjj_gio_hang">
							<input style="width:50px" value="<?php echo $solg; ?>" name="<?php echo $ten_input__solg; ?>" />
						</span></td>
						<td><span class="jjj_gio_hang"><?php echo $tv_2['dongia_sanpham']; ?></span></td>
						<td><span class="jjj_gio_hang"><?php echo $tong; ?></span></td>
					</tr>
				<?php
			}
		}
	  ?>
	  <tr>
	  	<td>&nbsp;</td>
		<td>&nbsp;</td>
		<td align="center"><span class="jjj_gio_hang">
			<input type="hidden" name="cap_nhat_gio_hang_ggg" value="cap_nhat_gio_hang_ggg" />
			<input type="submit" value="Cập nhật" />
		</span></td>
		<td>&nbsp;</td>
		<td><?php echo $tong_lon; ?></td>
	  </tr>
	</table>
</form>
</center>